
package com.ucitech.filedb;

/**
 *
 * @author Charlee
 */
public class KeyGenerator {
    private static KeyGenerator INSTANCE = new KeyGenerator();
    private long count;

    private KeyGenerator() {
        this.count = count();
    }
    
    public synchronized static KeyGenerator getInstance() {
        return INSTANCE;
    }
    
    public synchronized long id(){
        return ++count;
    }
    
    public String str(){
        return String.valueOf(id());
    }

    private long count() {
        return System.currentTimeMillis();
    }
}
